import Vue from 'vue'
import VueRouter from 'vue-router'
import Bar from '@/views/homeBar.vue'

//takeout二级路由
import Takeouta from "@/views/takeout/takeouta"
import Takeoutb from "@/views/takeout/takeoutb"
//takeout三级路由
import Takeoutaa from "@/views/takeout/takeoutaa"
import Takeoutab from "@/views/takeout/takeoutab"
import Takeoutac from "@/views/takeout/takeoutac"
import Takeoutad from "@/views/takeout/takeoutad"

Vue.use(VueRouter)

const routes = [{
        path: '/myself',
        name: 'Myself',
        component: () =>
            import ('@/views/myself.vue')
    },
    {
        path: '/shop',
        name: 'Shop',
        component: () =>
            import ('@/views/shop.vue')
    }, {
        path: '/massage',
        name: 'Masg',
        component: () =>
            import ('@/views/massage.vue')
    },
    {
        path: '/Bath',
        name: 'Bath',
        component: () =>
            import ('@/views/Bath.vue')
    },
    {
        path: '/wedding',
        name: 'Wedding',
        component: () =>
            import ('@/views/wedding.vue'),
    }, {
        path: '/shoplist',
        name: 'Shoplist',
        component: () =>
            import ('@/views/shoplist.vue')
    }, {
        path: '/news',
        name: 'News',
        component: () =>
            import ('@/views/news.vue')
    }, {
        path: '/login',
        name: 'Login',
        component: () =>
            import ('@/views/login.vue')
    }, {
        path: '/register',
        name: 'Register',
        component: () =>
            import ('@/views/register.vue')
    }, {
        path: '/others',
        name: 'Others',
        component: () =>
            import ('@/views/others.vue'),
        children: [{
            path: '/others/dfk',
            name: 'Dfk',
            component: () =>
                import ('@/views/others/dfk.vue')
        }, {
            path: '/others/dsh',
            name: 'Dsh',
            component: () =>
                import ('@/views/others/dsh.vue')
        }, {
            path: '/others/dpj',
            name: 'Dpj',
            component: () =>
                import ('@/views/others/dpj.vue')
        }, {
            path: '/others/dsy',
            name: 'Dsy',
            component: () =>
                import ('@/views/others/dsy.vue')
        }, {
            path: '/others/sh',
            name: 'Sh',
            component: () =>
                import ('@/views/others/sh.vue')
        }],
        beforeEnter(to, from, next) {
            if (!(window.localStorage.getItem('Token') != null) || (window.localStorage.getItem('Token') == "")) {
                alert("请登录");
                next("/login")
            } else {
                next();
            }

        }
    },
    {
        path: '/decorate',
        name: 'Decorate',
        component: () =>
            import ('@/views/decorate.vue'),
        children: [{
            path: '/decorate01',
            name: 'Decorate01',
            component: () =>
                import ('@/views/decorateluyou/decorate01.vue')
        }, {
            path: '/decorate02',
            name: 'Decorate02',
            component: () =>
                import ('@/views/decorateluyou/decorate02.vue')
        }, {
            path: '/decorate03',
            name: 'Decorate03',
            component: () =>
                import ('@/views/decorateluyou/decorate03.vue')
        }, {
            path: '/decorate04',
            name: 'Decorate04',
            component: () =>
                import ('@/views/decorateluyou/decorate04.vue')
        }, {
            path: '/decorate05',
            name: 'Decorate05',
            component: () =>
                import ('@/views/decorateluyou/decorate05.vue')
        }, {
            path: '/decorate06',
            name: 'Decorate06',
            component: () =>
                import ('@/views/decorateluyou/decorate06.vue')
        }, {
            path: '/decorate07',
            name: 'Decorate07',
            component: () =>
                import ('@/views/decorateluyou/decorate07.vue')
        }, {
            path: '/decorate08',
            name: 'Decorate08',
            component: () =>
                import ('@/views/decorateluyou/decorate08.vue')
        }, {
            path: '/decorate09',
            name: 'Decorate09',
            component: () =>
                import ('@/views/decorateluyou/decorate09.vue')
        }, ]
    },
    {
        path: '/quality',
        name: 'quality',
        component: () =>
            import ('@/views/quality.vue')
    },
    {
        path: '/takeout',
        name: 'Takeout',
        component: () =>
            import ('@/views/takeout.vue'),
        children: [{
                path: '/takeouta',
                name: 'Takeouta',
                component: Takeouta,
                children: [{
                        path: '/takeoutaa',
                        name: 'Takeoutaa',
                        component: Takeoutaa
                    },
                    {
                        path: '/takeoutab',
                        name: 'Takeoutab',
                        component: Takeoutab
                    },
                    {
                        path: '/takeoutac',
                        name: 'Takeoutac',
                        component: Takeoutac
                    },
                    {
                        path: '/takeoutad',
                        name: 'Takeoutad',
                        component: Takeoutad
                    }
                ]
            },
            {
                path: '/takeoutb',
                name: 'Takeoutb',
                component: Takeoutb
            }
        ]
    },

    {
        path: '/homeBar',
        name: 'Bar',
        component: Bar
    },
    {
        path: '/weddingmin/wedding1',
        name: 'Weda',
        component: () =>
            import ('@/views/weddingmin/wedding1.vue'),

    },
    {
        path: '/weddingmin/wedding2',
        name: 'Wedb',
        component: () =>
            import ('@/views/weddingmin/wedding2.vue'),

    },
    {
        path: '/weddingmin/wedding3',
        name: 'Wedc',
        component: () =>
            import ('@/views/weddingmin/wedding3.vue'),

    },
    {
        path: '/weddingmin/wedding4',
        name: 'Wedd',
        component: () =>
            import ('@/views/weddingmin/wedding4.vue'),

    },
    {
        path: '/weddingmin/wedding5',
        name: 'Wede',
        component: () =>
            import ('@/views/weddingmin/wedding5.vue'),

    },

]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router